<?php

// $Id$

require_once(TANGRA_MAIN_DIR.'form/fields/integer_positive/form_field_integer_positive_view.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/integer_limited/form_field_integer_limited_view.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/text/form_field_text_view.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/checkbox/form_field_checkbox_view.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/number/form_field_number_view.class.php');

require_once(TANGRA_MAIN_DIR.'form/guardable_form_view.class.php');


class Settings_Images_Form_View extends Guardable_Form_View {
	function __construct(Form &$form) {
		parent::__construct($form);

		$f_allowed_extensions = $form->get_field('allowed_extensions');
		$f_allowed_extensions_view = new Form_Field_Text_View($form->get_name().'_'.$f_allowed_extensions->get_name(), $f_allowed_extensions);
		$this->add_field_view('allowed_extensions', $f_allowed_extensions_view);

		$f_to_size_x = $form->get_field('to_size_x');
		$f_to_size_x_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_to_size_x->get_name(), $f_to_size_x);
		$this->add_field_view('to_size_x', $f_to_size_x_view);

		$f_to_size_y = $form->get_field('to_size_y');
		$f_to_size_y_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_to_size_y->get_name(), $f_to_size_y);
		$this->add_field_view('to_size_y', $f_to_size_y_view);

		$f_jpg_quality = $form->get_field('jpg_quality');
		$f_jpg_quality_view = new Form_Field_Integer_Limited_View($form->get_name().'_'.$f_jpg_quality->get_name(), $f_jpg_quality);
		$this->add_field_view('jpg_quality', $f_jpg_quality_view);

		$f_bgcolor = $form->get_field('bgcolor');
		$f_bgcolor_view = new Form_Field_Text_View($form->get_name().'_'.$f_bgcolor->get_name(), $f_bgcolor);
		$this->add_field_view('bgcolor', $f_bgcolor_view);

		$f_keep_original = $form->get_field('keep_original');
		$f_keep_original_view = new Form_Field_Checkbox_View($form->get_name().'_'.$f_keep_original->get_name(), $f_keep_original);
		$this->add_field_view('keep_original', $f_keep_original_view);

		$f_thumbnail1_size_x = $form->get_field('thumbnail1_size_x');
		$f_thumbnail1_size_x_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_thumbnail1_size_x->get_name(), $f_thumbnail1_size_x);
		$this->add_field_view('thumbnail1_size_x', $f_thumbnail1_size_x_view);

		$f_thumbnail1_size_y = $form->get_field('thumbnail1_size_y');
		$f_thumbnail1_size_y_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_thumbnail1_size_y->get_name(), $f_thumbnail1_size_y);
		$this->add_field_view('thumbnail1_size_y', $f_thumbnail1_size_y_view);

		$f_thumbnail2_size_x = $form->get_field('thumbnail2_size_x');
		$f_thumbnail2_size_x_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_thumbnail2_size_x->get_name(), $f_thumbnail2_size_x);
		$this->add_field_view('thumbnail2_size_x', $f_thumbnail2_size_x_view);

		$f_thumbnail2_size_y = $form->get_field('thumbnail2_size_y');
		$f_thumbnail2_size_y_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_thumbnail2_size_y->get_name(), $f_thumbnail2_size_y);
		$this->add_field_view('thumbnail2_size_y', $f_thumbnail2_size_y_view);

		$f_maximum_size = $form->get_field('maximum_size');
		$f_maximum_size_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_maximum_size->get_name(), $f_maximum_size);
		$this->add_field_view('maximum_size', $f_maximum_size_view);

		$f_maximum_size_x = $form->get_field('maximum_size_x');
		$f_maximum_size_x_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_maximum_size_x->get_name(), $f_maximum_size_x);
		$this->add_field_view('maximum_size_x', $f_maximum_size_x_view);

		$f_maximum_size_y = $form->get_field('maximum_size_y');
		$f_maximum_size_y_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_maximum_size_y->get_name(), $f_maximum_size_y);
		$this->add_field_view('maximum_size_y', $f_maximum_size_y_view);

		$f_minimum_ratio_xy = $form->get_field('minimum_ratio_xy');
		$f_minimum_ratio_xy_view = new Form_Field_Number_View($form->get_name().'_'.$f_minimum_ratio_xy->get_name(), $f_minimum_ratio_xy);
		$this->add_field_view('minimum_ratio_xy', $f_minimum_ratio_xy_view);

		$f_maximum_ratio_xy = $form->get_field('maximum_ratio_xy');
		$f_maximum_ratio_xy_view = new Form_Field_Number_View($form->get_name().'_'.$f_maximum_ratio_xy->get_name(), $f_maximum_ratio_xy);
		$this->add_field_view('maximum_ratio_xy', $f_maximum_ratio_xy_view);

		$f_watermark_image = $form->get_field('watermark_image');
		$f_watermark_image_view = new Form_Field_Text_View($form->get_name().'_'.$f_watermark_image->get_name(), $f_watermark_image);
		$this->add_field_view('watermark_image', $f_watermark_image_view);

		$f_watermark_position = $form->get_field('watermark_position');
		$f_watermark_position_view = new Form_Field_Integer_Positive_View($form->get_name().'_'.$f_watermark_position->get_name(), $f_watermark_position);
		$this->add_field_view('watermark_position', $f_watermark_position_view);

		$f_upload_path = $form->get_field('upload_path');
		$f_upload_path_view = new Form_Field_Text_View($form->get_name().'_'.$f_upload_path->get_name(), $f_upload_path);
		$this->add_field_view('upload_path', $f_upload_path_view);
	}
}
